#ifndef RATIONAL_H
#define RATIONAL_H

class Rational {
    int numerator;
    int denominator;
    static int gcd(int, int);
    void simplify();
    void normalize();
    friend bool operator ==(const Rational &, const Rational &);
    friend bool operator <(const Rational &, const Rational &);
public: 
    Rational(int, int denominator = -1);
    Rational & operator +=(const Rational &);
    Rational & operator -=(const Rational &);
    Rational & operator /=(const Rational &);
    Rational & operator *=(const Rational &);  
    Rational operator -() const;
    Rational & operator++();
    Rational operator++(int);
    Rational & operator--();
    Rational operator--(int);
    Rational inv() const;
    operator double() const;
};
bool operator ==(const Rational &, const Rational &);
bool operator <=(const Rational &, const Rational &);
bool operator >=(const Rational &, const Rational &);
bool operator <(const Rational &, const Rational &);
bool operator >(const Rational &, const Rational &);

Rational operator +(const Rational &, const Rational &);
Rational operator -(const Rational &, const Rational &);
Rational operator *(const Rational &, const Rational &);
Rational operator /(const Rational &, const Rational &);


#endif
